package cn.bellychang;

import org.apache.http.HttpResponse;
import org.apache.http.client.fluent.Request;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.config.server.EnableConfigServer;

import java.io.IOException;

@SpringBootApplication
@EnableConfigServer
public class ConfigApplication {

	private static final Logger LOGGER = LoggerFactory.getLogger(ConfigApplication.class);

	public static void main(String[] args) {

		SpringApplication.run(ConfigApplication.class, args);
		String url = "http://192.168.211.104:8888/bus/refresh";
		try {
			HttpResponse httpResponse = Request.Post(url).execute().returnResponse();
			int statusCode = httpResponse.getStatusLine().getStatusCode();
			if (statusCode == 200) {
				LOGGER.info("配置文件更新推送成功");
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
